GtkTextView: Preserve the cairo context around draw_layer
authorMatthias Clasen <mclasen@redhat.com>
Wed, 13 Aug 2014 13:14:22 +0000 (09:14 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 13 Aug 2014 13:18:08 +0000 (09:18 -0400)
Otherwise, draw_layer might unintentionally wreak havoc on the
regular drawing that happens between the two draw_layer calls.

gtk/gtktextview.c

index a3dee23a0c191be4dc854edc512744c53a48c57d..d61dff9361ed75c5eb98562e070ff220cc335c85 100644 (file)
@@ -5328,12 +5328,20 @@ draw_text (cairo_t  *cr,
   gtk_style_context_restore (context);
 
   if (GTK_TEXT_VIEW_GET_CLASS (text_view)->draw_layer != NULL)
-    GTK_TEXT_VIEW_GET_CLASS (text_view)->draw_layer (text_view, GTK_TEXT_VIEW_LAYER_BELOW, cr);
+    {
+      cairo_save (cr);
+      GTK_TEXT_VIEW_GET_CLASS (text_view)->draw_layer (text_view, GTK_TEXT_VIEW_LAYER_BELOW, cr);
+      cairo_restore (cr);
+    }
 
   gtk_text_view_paint (widget, cr);
 
   if (GTK_TEXT_VIEW_GET_CLASS (text_view)->draw_layer != NULL)
-    GTK_TEXT_VIEW_GET_CLASS (text_view)->draw_layer (text_view, GTK_TEXT_VIEW_LAYER_ABOVE, cr);
+    {
+      cairo_save (cr);
+      GTK_TEXT_VIEW_GET_CLASS (text_view)->draw_layer (text_view, GTK_TEXT_VIEW_LAYER_ABOVE, cr);
+      cairo_restore (cr);
+    }
 }
 
 static void